package cn.ibizlab.core.authentication.mapping;


import cn.ibizlab.core.authentication.domain.AuthGranted;
import cn.ibizlab.core.authentication.domain.AuthGrantedRole;
import cn.ibizlab.core.authentication.domain.AuthGrantedSystem;
import cn.ibizlab.core.authorization.domain.SysGrantedAuthority;
import cn.ibizlab.core.authorization.domain.SysRole;
import cn.ibizlab.core.system.domain.SysDeploySystem;
import org.mapstruct.*;

import java.util.List;

@Mapper(componentModel = "spring", uses = {},
        nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE,
        nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)

public interface AuthGrantedSystemMapping {

    @Mappings({
            @Mapping(source ="deploySystemId",target = "id"),
    })
    SysDeploySystem toSysDeploySystem(AuthGrantedSystem authGrantedSystem);

    @Mappings({
            @Mapping(source ="id",target = "deploySystemId"),
    })
    AuthGrantedSystem toAuthGrantedSystem(SysDeploySystem sysDeploySystem);

    @Mappings({
            @Mapping(source ="roleId",target = "id"),
            @Mapping(source ="displayName",target = "name"),
    })
    SysRole toSysRole(AuthGrantedRole authGrantedRole);

    @Mappings({
            @Mapping(source ="id",target = "roleId"),
            @Mapping(source ="name",target = "displayName"),
    })
    AuthGrantedRole toAuthGrantedRole(SysRole sysRole);

    @Mappings({
            @Mapping(source ="id",target = "roleId"),
            @Mapping(source ="name",target = "displayName"),
    })
    List<AuthGrantedRole> toAuthGrantedRole(List<SysRole> sysRole);

    List<SysRole> toSysRole(List<AuthGrantedRole> authGrantedRole);

    SysGrantedAuthority toSysGrantedAuthority(AuthGranted sysGrantedAuthority);

    AuthGranted toAuthGranted(SysGrantedAuthority sysGrantedAuthority);

    List<AuthGranted> toAuthGranted(List<SysGrantedAuthority> sysGrantedAuthority);
}
